﻿// Copyright (c)  YISH. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Collections.Generic;

namespace NSQL.Resource
{
    public class SchemaInfo : ISchemaInfo
    {
        private readonly List<ITableInfo> _tables = new List<ITableInfo>();
        public IDatabaseInfo DatabaseInfo { get; set; }
        public Identifier Name { get; set; }
        public IReadOnlyList<ITableInfo> Tables => _tables;
        public void Add(ITableInfo tableInfo) => _tables.Add(tableInfo);

        public void Add(TableInfo tableInfo)
        {
            tableInfo.Schema = this;
            _tables.Add(tableInfo);
        }
    }
}